Change-point detection using diffusion maps for sleep apnea monitoring with contact-free sensors

Monitoring and improving the quality of sleep are crucial from a public health perspective. In this study, we propose a change-point detection method using diffusion maps for a more accurate detection of respiratory arrest points. Conventional change-point detection methods are limited when dealing with complex nonlinear data structures, and the proposed method overcomes these limitations. The proposed method embeds subsequence data in a low-dimensional space while considering the global and local structures of the data and uses the distance between the data as the score of the change point. Experiments using synthetic and real-world contact-free sensor data confirmed the superiority of the proposed method when dealing with noise, and it detected apnea events with greater accuracy than conventional methods. In addition to improving sleep monitoring, the proposed method can be applied in other fields, such as healthcare, manufacturing, and finance. This study will contribute to the development of advanced monitoring systems that adapt to diverse conditions while protecting privacy.


Introduction
Sleep is an essential component of human health and well-being, and maintaining its quality is an important public health issue [1].Impaired sleep quality has negative consequences, ranging from chronic health problems to poor performance in daily life [2][3][4][5][6][7].Therefore, accurate detection of changes in sleep patterns and early identification of potential disturbances are critical to the development of effective sleep management and intervention strategies.Recently, there has been significant progress in sleep disorder monitoring technologies, and more precise and user-friendly methods have emerged [8,9].Conventional polysomnography-based sleep monitoring techniques [10,11] are invasive and can affect the comfort and privacy of patients; however, a contactless approach using modern sensor technology [12][13][14][15][16][17][18][19][20][21] can overcome these challenges.Among the available strategies, detecting change points in time series data plays a central role in the diagnosis of sleep disorders and evaluation of sleep quality.In this study, we propose a new change point detection method that goes beyond conventional methods to capture changes where breathing stops more accurately.It aims to provide insights to improve the quality of sleep and ultimately improve people's quality of life.
Change-point detection involves identifying the instance at which the behavior of timeseries data changes (i.e., change points), such as shifts in mean value or variance.Several methods have been proposed to achieve this, and it has received considerable attention in statistical and machine learning because of its wide range of applications, including quality control [22], climate research [23], and speech recognition [24].In the classic approach, the change point is captured based on cumulative sum (CUMSUM) statistics [25], Hotelling's T 2 (H-T2), and knearest neighbors (KNN) method.CUMSUM statics is widely used today for detecting changes in the mean structure over time as well as in the variance structure [26][27][28].Another method, single-spectrum transformation (SST) [29][30][31], detects the change point using the subspace method with partial time-series data without estimating the density ratio.SST extracts representative waveforms from past and present sub-sequence time series data using the subspace method compares them and detects large changes as change points.As SST performs better for time-series data with periodic changes, it is more effective for time-series sensor data during sleep.However, in the context of change point detection during sleep using contact-free sensors, factors such as environmental noise and sensor drift can influence the readings, potentially leading to false detections or missed change points.Even with the SST method, these types of noise can affect the process of extracting representative waveforms from partial time-series data.Because these representative waveforms are derived via principal component analysis (PCA), a linear dimensionality reduction method, there are limitations to adequately capturing more complex waveforms with nonlinear structures.To address these challenges, it is necessary to develop a change point detection method suitable for sleep monitoring using non-contact sensors.By enhancing the robustness against noise, a more accurate analysis of sleep states can be achieved, thereby improving the quality of sleep monitoring.It is anticipated that these improved methods will contribute to early detection of sleep disorders and enhancement of sleep quality in the future.
In this study, we introduce a sophisticated method that enhances the capabilities of changepoint detection beyond the conventional SST approach to address the limitations of existing techniques.We propose a novel change-point detection method that uses diffusion maps [32] (CPD-DM), which is a nonlinear dimensionality-reduction method, based on the SST algorithm [24].In PCA, the Euclidean distance is used to extract representative waveforms.In diffusion maps, the diffusion distance is utilized to extract waveforms, considering the transition probability from past data.This allows for a more nuanced analysis of the geometry of the data and capturing of the underlying dynamics of the time series.This study aims to verify the detection accuracy for changes in mean and variance within time-series data using simulated data and to confirm the precision in detecting apnea events using real-world data, as well as under conditions of strong noise interference.This will ascertain whether enhanced accuracy can be achieved in response to realistic noise scenarios that are likely to occur.
The remainder of this paper is organized as follows.The Methods section reviews changepoint detection using the sub-sequence data and defines the proposed method.The Experimental Results and Discussion section evaluates the proposed method using two artificial datasets and real-world contact-free sensor data.Finally, the Conclusions section presents the conclusions and future work of the study.

Methods
This section establishes the problem and formulates change-point detection using subsequence data.Furthermore, the SST method based on the proposed method is introduced.Finally, the proposed change-point detection method is described.

Problem setup
Suppose that X = [x 1 ,x 2 ,� � �,x N ]2R N is the one-dimensional (1D) sequence data of N time points, and x t = [x t ,x t+1 ,� � �,x t+h ]2R h consists of h consecutive data points starting at time t.The parameter h is called the window size.Therefore, the past sub-sequence data P (t) and current sub-sequence data Q (t) can be defined as follows: P ðtÞ ¼ ½x tÀ r 1 À hþ1 ; . . .; x tÀ hÀ 1 ; x tÀ h � ¼ ½p 1 ; p 2 ; . . .; p r 1 � 2 R h�r 1 ; ð1Þ Q ðtÞ ¼ ½x tÀ r 2 À hþ1 ; . . .; x tÀ hÀ 1þL ; x tÀ hþL � ¼ ½q 1 ; q 2 ; . . .; q r 2 � 2 R h�r 2 ; ð2Þ where r 1 and r 2 represent the number of vectors x t aggregated in matrices P (t) and Q (t) , respectively; and L is a non-negative constant that indicates the time difference between P (t) and Q (t) , which is referred to as the lag.Notably, P (t) and Q (t) are the Hankel matrices that serve a function in changepoint detection using subspace learning [29][30][31]33].In change-point detection using sub-sequence time-series data, subspaces are obtained from P (t) and Q (t) , and the score of the difference between subspaces is defined as the change score.If the change score at time t is greater than the threshold value, it is detected as a change point.

Singular Spectrum Transformation (SST)
SST involves performing PCA to obtain the subspace from the generated sub-sequence data P (t) and Q (t) .Essentially, it computes the r left singular vector U ðtÞ r 2 R w�r and Z ðtÞ r 2 R w�r by x t is the data point at time t with consecutive points h.Two windows, P (t) and Q (t) , are shown at different positions along the time axis, each containing a subset of the data points within lengths r 1 and r 2 , respectively.L represents the lag between the window P (t) and Q (t) . https://doi.org/10.1371/journal.pone.0306139.g001 singular-value decomposition of matrices P (t) and Q (t) , respectively.
P ðtÞ � U ðtÞ r S P V P T ; where S is the diagonal matrix with singular values as diagonal elements and V is the right singular vector.The change in score is defined as follows: Singular-value decomposition performed in SST may result in insufficient change-point detection for waveforms with a nonlinear structure owing to the linear dimensionality-reduction method.This method was proposed for multichannel (multidimensional) sequence data [34].

Proposed method (CPD-DM)
The overall framework of the CPD-DM is depicted in Fig 2 .This framework is based on SST and comprises two parts.First, the subspace is determined using a diffusion map from each of the two sub-sequence data P (t) and Q (t) .Next, change points are extracted using the difference in the space as a change score.Furthermore, an extension of the proposed method for application in multidimensional sequence data is discussed below.
(a) Embedding in the subspace.The current sub-sequence data Q (t) was embedded in the same subspace after determining the low-dimensional space using the diffusion map for past sub-sequence data P (t) .The diffusion map defines a distance function called the diffusion distance, which corresponds to the geodesic distance on a manifold, by defining a random walk on a set of M data points and constructing a low-dimensional space in which this distance is equal to the Euclidean distance.
First, a graph of data P (t) is constructed.Next, the Gaussian kernel function is used for the edge weight of the graph.The i,j elements of the matrix W are as follows: where σ i and σ j are the local scale parameters for p i and p j , respectively.Here, where p K j is the Kth nearest neighbor of p i .Notably, Zelink-Manor and Perona [35] recommended a K value of 7, which was adopted in this study.Next, matrix W is normalized such that the rows sum to 1. Therefore, matrix D (1) is formed, as follows. )is considered a Markov matrix that defines the forward transition probability matrix of the dynamical process, because the diffusion map originates from the dynamical system theory.Therefore, matrix D (1) represents the probability of transition from one data point to another in a single time step.The forward probability matrix of α time step D (α) is given by ðD ð1Þ Þ a .Using the random walk forward probability d ðaÞ i;j , the diffusion distance is defined as follows.
ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi X where b i is the degree of node p i defined by b i = S j d i,j .With the spectral theory of random walk (refer to [36]), the representation PðtÞ that ensures that the low-dimensional diffusion distance Diffusion (α) (p i ,p j ) is as good as possible is formed by the r eigenvectors of the eigenproblem In a low-dimensional representation, the eigenvector is normalized by the corresponding eigenvalue, that is, where r is the reduced dimension.Finally, the low-dimensional representation QðtÞ ¼ ½q 1 ; q2 ; . . .; qr � is determined by projecting the current sub-sequence data Q (t) to the same subspace as PðtÞ , and the linear mapping is calculated using a nonparametric out-of-sample extension method [37]; notably, this method can be applied to all nonlinear dimensionality-reduction methods.Therefore, the nearest neighbor of the data point q i in the original dimensional space is determined, and linear mapping from the nearest neighbor to the corresponding low-dimensional space is calculated.The low-dimensional space QðtÞ is represented by applying linear mapping to the data points of Q (t) .
(b) Definition of change score.In the same embedded subspace, the score S(t) at time point t is defined as the distance between matrices PðtÞ and QðtÞ , as follows: The embedded low-dimensional space considers the global structure, while preserving the local data structure in the original dimensional space.Therefore, if the local and global data structures in the original dimensional space of the two sub-sequence data P (t) and Q (t) are similar, they are embedded close to each other in the low-dimensional space.Consequently, when the score is small, the structures of P (t) and Q (t) are similar; in contrast, when it is large, a large change in P (t) and Q (t) is observed.
(c) Extension to multidimensional data.For multidimensional data, the past and current sub-sequence data P and Q are set as follows: where P ðtÞ i and Q ðtÞ i are calculated using Eq (1) and ( 2), respectively, for ith dimension data.Next, steps (a) and (b) are executed for matrices P and Q. Algorithm 1 summarizes the algorithm for the proposed collaborative novelty detection.1. Calculate the sub-sequence matrices P and Q in Eqs ( 6) and ( 7) from the current and past sub-sequence data.
2. Solve Eq (3) for eigenvalues and eigenvectors from matrix P.
3. Compute the low-dimensional representation PðtÞ in Eq (4).4. Compute the low-dimensional space QðtÞ by applying linear mapping.

Experimental results and discussion
This section evaluates the proposed CPD-DM for synthetic and contact-free sensor datasets.
The proposed method was compared with conventional statistical methods, namely, the H-T2, k-nearest neighbor (KNN), and SST methods.The area under the curve (AUC), F1-score, and Rand index (RI) [38] were used as the performance metrics for the detected change points.Let n be the number of correct change points at moments τ 1 ,τ 2 ,� � �,τ n and n be the number of predicted change points at moments t1 ; t2 ; . . .; tn .A set of correctly detected change points is defined as the true positive (TP) [39]: TP ¼ ft i j9t j : jt j À t i j < Mg, where M is a margin size.The F1-score measure is then defined as follows: where Precision ¼ jTPj=n, and Recall = |TP|/n.For the AUC, a binary classification problem is considered, where the true label consists of {0,1}, class 1 contains the correct change-points in ½t i À M � t i � t i þ M�ði ¼ 1; 2; . . .; nÞ, and class 0 the rest.Subsequently, the AUC is calculated using the true labels and change-point scores.Notably, F1 and RI determine the number of change points to be detected.Next, the detected points are checked to ascertain whether they fall within M points before and after the true change point.The AUC uses the magnitude of the change score to calculate the detection measurements without determining the number.

Synthetic datasets
In this study, two types of toy problems were considered.For both dataset types, 10 samples of 10D data were created, with a length of 2000, and a change-point was generated every 200-time points.The first dataset, denoted as (a), contained data in which the average value changed, and the second dataset, denoted as (b), contained data in which the variance value changed.Next, Table 1 presents the mean values of AUC, F1, and RI for datasets (a) and (b).The bold numbers are the best scores.In dataset (a), the proposed method was the best for all measures.In dataset (b), the proposed method obtained the best results in terms of the AUC.For the F1 measure, H-T2 yielded the best values; however, all the methods exhibited low accuracy.For the RI measure, the KNN and SST achieved the best values; however, the accuracy of the proposed CPD-DM was similar.Therefore, CPD-DM's change scores are highly reliable when detecting the change points, making it more accurate with fewer false positives than the other methods.

Contact-free sensor signals
A public dataset [17] obtained from previous research was used in this study.It was collected from 30 healthy volunteers who performed an apnea hemodynamic scenario.However, this dataset was not recorded for all the subjects, and consequently, it contains data of only 23 subjects.In this scenario, the participants held their breath twice for as long as possible.In the first simulation, they fully inhaled before holding their breath.In the second simulation, they fully  The metrics provided as the area under the curve (AUC), F1-score, and Rand index (RI) are used to evaluate the effectiveness of the proposed method (CPD-DM), Hotelling's T 2 (H-T2), k-nearest neighbor (KNN), and singular spectrum transformation (SST) methods in detecting change points within (a) average value changes dataset and (b) variance value changes dataset. https://doi.org/10.1371/journal.pone.0306139.t001 exhaled before holding their breath.Because the button was pressed at the same time as the event in the simulation, the times when breath-holding began and ended were given.In this study, we used the start and end points of the simulation as change points.Three features from the contact-free sensors were employed: radar I, radar Q, and distance (computed from radar I and radar Q).For data preprocessing, the absolute value of the fast Fourier transformation for each feature was added; that is, six features were used.The original data were sampled at 2000 frequencies and initially downsampled to a sampling frequency of 100 Hz.The data length ranged from 9550-40180.Furthermore, the window size h was set to 200, 400, . .., 2000 for all the methods to achieve the best AUC, and L ¼ h 4 and M = 500 were utilized as performance metrics.An experiment was performed by adding noise to the contact-free sensors to confirm the robustness of the proposed method against noise: the noise was a random number generated from a normal distribution with a mean of 0 and an SD of ŝ.Moreover, an experiment was performed by varying ŝ from 0.1 to 1, in increments of 0.1.
Table 2 presents the mean performance metrics without the noise dataset.The bold values are the best scores.The proposed CPD-DM exhibited the best performance in detecting the change points for contact-free sensor data.For the AUC, H-T2 yielded the worst performance, and KNN and SST exhibited acceptable performance but were inferior to CPD-DM.Therefore, the proposed method can detect the point at which respiration stops more accurately than the conventional methods in an apnea scenario using contact-free sensor data.
Fig 5 depicts the performance metrics for the sensor dataset with noise when the SD is varied from 0.1 to 1 in increments of 0.1.The proposed CPD-DM achieved performance measure values equivalent to or higher than those of the conventional methods.In terms of the AUC,  KNN and SST could not maintain their accuracy when the SD of the noise increased, that is, when the noise increased.However, the proposed method maintained its accuracy under this condition.Therefore, the proposed CPD-DM is robust against noise.Because this experiment can be verified with only one dataset, more diverse data sources were necessary.In the future, the performance of the proposed method in real-world scenarios, such as monitoring of patients with sleep apnea using contact-free sensors in home or hospital settings, should be investigated.Moreover, the scalability and computational efficiency of this method need to be evaluated when dealing with large data and various sensor types.The experimental results provided evidence to support the hypothesis regarding the effectiveness of the proposed change-point detection method using diffusion maps for apnea simulations.The results demonstrate that the method outperforms the conventional SST method in terms of accuracy and robustness against noise.Furthermore, the findings suggest that the proposed method cab be applied to other contactless sensor data types and that its potential usefulness can be extended beyond sleep monitoring.The development of novel methods that can deal with complex nonlinear structures can improve the accuracy of change-point detection in various applications, including sleep monitoring and other health-related monitoring tasks.

Conclusions
In this study, we proposed a novel change-point detection method to accurately detect the change points (i.e., respiration stopping points).Our method utilizes both, current and past sub-sequence data, at a point and embeds them in a low-dimensional space using diffusion maps.Because the global structure is considered in the low-dimensional space while preserving the local data structure in the original space, the distance between two sub-sequence data is used as the change score.A large distance indicates that the preceding and following subsequence data at a point are not similar and the change is significant.Furthermore, the generalization of multidimensional signal data was proposed.Numerical tests verified the effectiveness of the proposed method.Experiments were conducted using synthetic and real-world contact-free sensor data to evaluate the performance of the methods under various scenarios, including the presence of noise or other common obstacles found in the sensor data.We confirmed that the proposed method was robust to noise, accurately detected change points in the simulation of sleep apnea, and was superior to conventional methods in terms of accuracy and reliability.Furthermore, the proposed method reduces the testing load, supports monitoring in various settings, and ensures privacy.In the future, the generalizability of this method to other types of data should be explored and its performance in real-world applications should be evaluated.Furthermore, the scalability of the method and its computational efficiency in handling large-scale data must be considered.This study contributes to improving sleep monitoring by providing a more accurate and reliable change-point detection method.The proposed method can also be applied to other fields such as healthcare, manufacturing, and finance where change-point detection is important.Ultimately, this research will contribute to the development of advanced monitoring systems that guarantee privacy and adaptability across various scenarios.
Fig 1 illustrates an example of the notations used for 1D sequence data.

Fig 1 .
Fig 1.Example of notations in one-dimensional time-series data.x t is the data point at time t with consecutive points h.Two windows, P(t) and Q(t) , are shown at different positions along the time axis, each containing a subset of the data points within lengths r 1 and r 2 , respectively.L represents the lag between the window P (t) and Q(t) .

Fig 2 .
Fig 2. Framework of the proposed CPD-DM method.P (t) and Q (t) are transformed into their respective P~ðtÞ and Q~ðtÞ representation in an r^dimensional space.The change score S(t) is calculated by measuring the norm of the difference between P~ðtÞ and Q~ðtÞ .https://doi.org/10.1371/journal.pone.0306139.g002 data X2R N×m , dimension of the reduced space r, window size h, and lag L. Output: change score S. For each time point:

[0, 1 ]
range normalization was performed for preprocessing, the window size h was set to 20, 40, . .., and 200 for all methods to achieve the best AUC, lag L ¼ h 4 , and margin M = 20.Figs 3 and 4 illustrate the change score for each method depending on the window size when the AUC is the best for both datasets.The top image shows the first dimension of the normalized data, and the dotted lines indicate the changepoints.Evidently, the proposed CPD-DM detected almost all the change points, and the grater the change, the larger the change score, such as 400, 600, and 1800 points for dataset (a) and 200, 1000, and 1600 points for dataset (b).In dataset (a), the KNN and SST exhibited low change scores at points with small changes, which were difficult to detect as change points.In dataset (b), the KNN, SST, and H-T2 methods barely detected the true change points.

Fig 3 .
Fig 3. Change scores of each method for one sample of (a) average value changes dataset.The top panel shows the normalized data along the first dimension of average value changes dataset.Subsequent panels illustrate the change scores obtained using the proposed method (CPD-DM; red), Hotelling's T 2 (H-T2; blue), k-nearest neighbor (KNN; green), and singular spectrum transformation (SST; cyan).Each method's change scores are plotted over the same time scale, with significant peaks indicating detected change points.The vertical dashed lines represent the actual change points.https://doi.org/10.1371/journal.pone.0306139.g003

Fig 4 .
Fig 4. Change scores of each method for one sample of (b) variance value changes dataset.The top panel shows the normalized data along the first dimension of variance value changes dataset.Subsequent panels illustrate the change scores obtained using the proposed method (CPD-DM; red), Hotelling's T 2 (H-T2; blue), k-nearest neighbor (KNN; green), and singular spectrum transformation (SST; cyan).Each method's change scores are plotted over the same time scale, with significant peaks indicating detected change points.The vertical dashed lines represent the actual change points.https://doi.org/10.1371/journal.pone.0306139.g004

Fig 5 .
Fig 5. Mean performance measures for changing standard deviations of noise.Area under the curve (AUC), F1-score, and Rand index (RI) for each change point detection method under varying levels of noise standard deviation (sigma).The performance of the proposed method (CPD-DM; red), Hotelling's T 2 (H-T2; blue), k-nearest neighbor (KNN; green), and singular spectrum transformation (SST; cyan) is plotted to illustrate the effect of noise on detection accuracy.Each line connects the mean metric values calculated at different sigma values, demonstrating the robustness of the methods to noise.https://doi.org/10.1371/journal.pone.0306139.g005 ðtÞ 1 ; P ðtÞ 2 ; . . .; P ðtÞ m � 2 R h�ðr 1 mÞ ; ð6Þ